package com.gensdai.leliang.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gensdai.leliang.R;
import com.gensdai.leliang.entity.User;

import java.util.List;

/**
 * Created by Administrator on 2017/6/2.
 */

public class Use_Bei_Deal_adapter extends BaseAdapter {

    Context mContext;
    List<User> list;
    Honder honder;

    public Use_Bei_Deal_adapter(Context context, List<User> list) {
        mContext = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            honder = new Honder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.use_bei_deal_adapter, null);
            honder.IndentMoney = (TextView) convertView.findViewById(R.id.indentmoney);
            honder.GiveMoneyTime = (TextView) convertView.findViewById(R.id.givemoneytime);
            honder.UseCZB = (TextView) convertView.findViewById(R.id.useczb);
            honder.TrueMonet = (TextView) convertView.findViewById(R.id.truemoney);
            convertView.setTag(honder);
        } else {
            honder = (Honder) convertView.getTag();
        }
        honder.IndentMoney.setText(list.get(position).getIndentMoney());
        honder.UseCZB.setText(list.get(position).getUseCZB());
        honder.GiveMoneyTime.setText(list.get(position).getGiveMoneyTime());
        honder.TrueMonet.setText(list.get(position).getTrueMoney());

        return convertView;
    }

    class Honder {

        TextView IndentMoney; //付款金额
        TextView GiveMoneyTime; // 付款时间
        TextView UseCZB; // 使用成长贝
        TextView TrueMonet; // 实际付款金额
    }

}
